package com.ybbase.framework.model.po.system;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 系统用户表
 * </p>
 *
 * @author cg
 * @since 2019-11-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sys_user")
@ApiModel(value="User对象", description="系统用户表")
public class User extends Model<User> {

    private static final long serialVersionUID=1L;

    @ApiModelProperty(value = "唯一编码")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private Integer createBy;

    @ApiModelProperty(value = "创建时间 : 创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDate;

    @ApiModelProperty(value = "更新人 : 更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateBy;

    @ApiModelProperty(value = "更新人 : 更新人")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "备注")
    private String remarks;

    @ApiModelProperty(value = "删除标示 : 0未删除 1已删除")
    @TableLogic
    private Integer delFlag;

    @ApiModelProperty(value = "乐观锁版本管理")
    private Integer version;

    @ApiModelProperty(value = "登录用户名")
    private String loginName;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "工号")
    private String workNo;

    @ApiModelProperty(value = "真实姓名")
    private String name;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "联系电话")
    private String phone;

    @ApiModelProperty(value = "用户类型 : 0系统内用户1系统外用户 ")
    private Integer userType;

    @ApiModelProperty(value = "最后登陆IP")
    private String loginIp;

    @ApiModelProperty(value = "最后登陆时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")     private Date loginDate;

    @ApiModelProperty(value = "当前是否在线 : 0不在线 1在线")
    private Integer loginFlag;

    @ApiModelProperty(value = "性别 : 0男 1女")
    private Integer sex;

    @ApiModelProperty(value = "用户图标")
    private Integer icon;

    @ApiModelProperty(value = "是否为管理员0不是1是")
    private Integer isAdmin;

    @ApiModelProperty(value = "部门ID")
    @TableField(fill = FieldFill.INSERT)
    private Integer organId;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    /**************************扩展*****************************/
    @ApiModelProperty(value = "用户图标路径")
    @TableField(exist = false)
    private String iconPath;

    @ApiModelProperty(value = "用户角色列表")
    @TableField(exist = false)
    private List<Role> roleList;

    @ApiModelProperty(value = "用户角色Ids")
    @TableField(exist = false)
    private String roleIds;

    @ApiModelProperty(value = "组织机构列表")
    @TableField(exist = false)
    private List<Organization> organizationList;

    @ApiModelProperty(value = "企业信息")
    @TableField(exist = false)
    private Organization organCompany;

    @ApiModelProperty(value = "岗位用户")
    @TableField(exist = false)
    private List<OrganUser> organUserList;

    @ApiModelProperty(value = "默认机构Id")
    @TableField(exist = false)
    private Integer defaultOrgId;

    @ApiModelProperty(value = "默认机构名称")
    @TableField(exist = false)
    private String defaultOrgName;

    @ApiModelProperty(value = "角色名称")
    @TableField(exist = false)
    private String roleNames;

    @ApiModelProperty(value = "所有用户权限")
    @TableField(exist = false)
    private String allUserPermissionScope;

    @ApiModelProperty(value = "角色名称")
    @TableField(exist = false)
    private String userPermissionScope;
}
